<?php

use think\facade\Route;

// 分销路由
Route::group('commission', function () {
    Route::get('agent/select', 'admin.commission.Agent/select');
    Route::get('level/select', 'admin.commission.Level/select');

    Route::group(function () {
        // 分销商等级
        Route::resource('level', 'admin.commission.Level');

        // 分销商团队信息
        Route::get('agent/team/:id', 'admin.commission.Agent/team');
        // 更换推荐人
        Route::post('agent/changeParentUser/:id', 'admin.commission.Agent/changeParentUser');
        // 分销商路由
        Route::resource('agent', 'admin.commission.Agent');

        // 分销订单管理
        Route::get('order', 'admin.commission.Order/list');
        Route::post('order/back', 'admin.commission.Order/back');
        Route::post('order/edit', 'admin.commission.Order/edit');
        Route::post('order/cancel', 'admin.commission.Order/cancel');
        Route::post('order/confirm', 'admin.commission.Order/confirm');
        Route::get('order/export', 'admin.commission.Order/export');

        // 分销佣金
        Route::get('reward/export', 'admin.commission.Reward/export');
        Route::resource('reward', 'admin.commission.Reward');
        // 分销动态
        Route::resource('log', 'admin.commission.Log');
        // 分销商品管理
        Route::resource('goods', 'admin.commission.Goods');
    })->middleware('check_rule');
});
